home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 23
/
Amiga Format AFCD23 (Feb 1998, Issue 107).iso
/
mui
/
mui_developer
/
c
/
examples
/
pages.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-03-10
|
3KB
|
105 lines
#include "demo.h"
static char *Sex[] = { "male","female",NULL };
static char *Pages[] = { "Race","Class","Armor","Level",NULL };
static char *Races[] = { "Human","Elf","Dwarf","Hobbit","Gnome",NULL };
static char *Classes[] = { "Warrior","Rogue","Bard","Monk","Magician","Archmage",NULL };
int main(int argc,char *argv[])
{
APTR app,window;
init();
app = ApplicationObject,
MUIA_Application_Title , "Pages-Demo",
MUIA_Application_Version , "$VER: Pages-Demo 19.5 (12.02.97)",
MUIA_Application_Copyright , "©1992/93, Stefan Stuntz",
MUIA_Application_Author , "Stefan Stuntz",
MUIA_Application_Description, "Show MUIs Page Groups",
MUIA_Application_Base , "PAGESDEMO",
SubWindow, window = WindowObject,
MUIA_Window_Title, "Character Definition",
MUIA_Window_ID , MAKE_ID('P','A','G','E'),
WindowContents, VGroup,
Child, ColGroup(2),
Child, Label2("Name:"), Child, String("Frodo",32),
Child, Label1("Sex:" ), Child, Cycle(Sex),
End,
Child, VSpace(2),
Child, RegisterGroup(Pages),
MUIA_Register_Frame, TRUE,
Child, HCenter(Radio(NULL,Races)),
Child, HCenter(Radio(NULL,Classes)),
Child, HGroup,
Child, HSpace(0),
Child, ColGroup(2),
Child, Label1("Cloak:" ), Child, CheckMark(TRUE),
Child, Label1("Shield:"), Child, CheckMark(TRUE),
Child, Label1("Gloves:"), Child, CheckMark(TRUE),
Child, Label1("Helmet:"), Child, CheckMark(TRUE),
End,
Child, HSpace(0),
End,
Child, ColGroup(2),
Child, Label("Experience:" ), Child, Slider(0,100, 3),
Child, Label("Strength:" ), Child, Slider(0,100,42),
Child, Label("Dexterity:" ), Child, Slider(0,100,24),
Child, Label("Condition:" ), Child, Slider(0,100,39),
Child, Label("Intelligence:"), Child, Slider(0,100,74),
End,
End,
End,
End,
End;
if (!app)
fail(app,"Failed to create Application.");
DoMethod(window,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
/*
** This is the ideal input loop for an object oriented MUI application.
** Everything is encapsulated in classes, no return ids need to be used,
** we just check if the program shall terminate.
** Note that MUIM_Application_NewInput expects sigs to contain the result
** from Wait() (or 0). This makes the input loop significantly faster.
*/
set(window,MUIA_Window_Open,TRUE);
{
ULONG sigs = 0;
while (DoMethod(app,MUIM_Application_NewInput,&sigs) != MUIV_Application_ReturnID_Quit)
{
if (sigs)
{
sigs = Wait(sigs | SIGBREAKF_CTRL_C);
if (sigs & SIGBREAKF_CTRL_C) break;
}
}
}
set(window,MUIA_Window_Open,FALSE);
/*
** Shut down...
*/
fail(app,NULL);
}